home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / M / Mac gperf 1.9.cpt / Mac gperf 1.9 / src / iterator.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-09  |  2.1 KB  |  51 lines  |  [TEXT/KAHL]

  1. /* Provides an Iterator for keyword characters.
  2.  
  3.    Copyright (C) 1989 Free Software Foundation, Inc.
  4.    written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  5.  
  6. This file is part of GNU GPERF.
  7.  
  8. GNU GPERF is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 1, or (at your option)
  11. any later version.
  12.  
  13. GNU GPERF is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with GNU GPERF; see the file COPYING.  If not, write to
  20. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  21.  
  22. /* Provides an Iterator that expands and decodes a control string containing digits
  23.    and ranges, returning an integer every time the generator function is called.
  24.    This is used to decode the user's key position requests.  For example:
  25.    "-k 1,2,5-10,$"  will return 1, 2, 5, 6, 7, 8, 9, 10, and 0 ( representing
  26.    the abstract ``last character of the key'' on successive calls to the
  27.    member function operator ().
  28.    No errors are handled in these routines, they are passed back to the
  29.    calling routines via a user-supplied Error_Value */
  30.  
  31. #ifndef _iterator_h
  32. #define _iterator_h
  33. #define _H_iterator
  34.  
  35. #include "prototype.h"
  36.  
  37. typedef struct iterator 
  38. {
  39.   char *str;                    /* A pointer to the string provided by the user. */
  40.   int   end;                    /* Value returned after last key is processed. */
  41.   int   end_word;               /* A value marking the abstract ``end of word'' ( usually '$'). */
  42.   int   error_value;            /* Error value returned when input is syntactically erroneous. */
  43.   int   hi_bound;               /* Greatest possible value, inclusive. */
  44.   int   lo_bound;               /* Smallest possible value, inclusive. */
  45. } ITERATOR;
  46.  
  47. extern    void    iterator_init( char *s, int lo, int hi, int word_end, int bad_val, int key_end );
  48. extern    int        next( void );
  49.  
  50. #endif /* _iterator_h */
  51.